﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Amazon.PAAPI.Amazon.PAAPI;



namespace Amazon.PAAPI
{
    class Program
    {
        static void Main(string[] args)
        {
            // Instantiate Amazon ProductAdvertisingAPI client
            AWSECommerceServicePortTypeClient amazonClient = new AWSECommerceServicePortTypeClient();

            // prepare an ItemSearch request
            ItemSearchRequest request = new ItemSearchRequest();
            request.SearchIndex = "VideoGames";
            request.Title = "Call of";
            request.ResponseGroup = new string[] { "Small" };
            Amazon.PAAPI.ItemSearch itemSearch = new Amazon.PAAPI.ItemSearch();
//            ItemSearch itemSearch = new ItemSearch();
            itemSearch.Request = new ItemSearchRequest[] { request };
            itemSearch.AWSAccessKeyId = ConfigurationManager.AppSettings["accessKeyId"];
            //itemSearch.AssociateTag = "Call of Duty!!!!!!";

            // send the ItemSearch request
            ItemSearchResponse response = amazonClient.ItemSearch();

            // write out the results from the ItemSearch request
            foreach (var item in response.Items[0].Item)
            {
                Console.WriteLine(item.ItemAttributes.Title);
                Console.WriteLine(item.ASIN);
            }
            Console.WriteLine("done...enter any key to continue>");
            Console.ReadLine();

        }
    }
}
